home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 351-375 / 371 / pplib / latticeglue.asm < prev    next >
Assembly Source File  |  1995-03-14  |  4KB  |  142 lines

  1. ****************************************************
  2. *                                                  *
  3. *       PowerPacker library glue code              *
  4. *       (for Lattice C)                            *
  5. *                                                  *
  6. *       Copyright (c) 1990 by Nico François        *
  7. *                                                  *
  8. ****************************************************
  9.  
  10. *********************************************************************
  11. *                                                                   *
  12. *    To assemble the SMALL_CODE version USE:                        *
  13. *      ASM -oLIB:ppSCglue.o -iINCLUDE: -dSMALL_CODE latticeglue.asm *
  14. *                                                                   *
  15. *    To assemble the LARGE_CODE version USE:                        *
  16. *      ASM -oLIB:ppLCglue.o -iINCLUDE: -dLARGE_CODE latticeglue.asm *
  17. *                                                                   *
  18. *    To use link with 'LIB:ppSCglue.o' or 'LIB:ppLCglue.o'          *
  19. *                                                                   *
  20. *    (based on ARP glue code, thanks arp :-)                        *
  21. *                                                                   *
  22. *********************************************************************
  23.  
  24.          IFND LIBRARIES_POWERPACKER_LIB_I
  25.          include "libraries/powerpacker_lib.i"
  26.          ENDC
  27.  
  28. * First some macros
  29.  
  30. GLUEDEF  MACRO
  31.          XDEF _\1
  32. _\1:
  33. THIS_LIB SET _LVO\1           ; Set the offset to call
  34.          ENDM
  35.  
  36. *
  37. *        Set SMALL_CODE=1 for a4 addressing...
  38. *        Set LARGE_CODE=1 for absolute addressing...
  39. *        if neither, just cause an error...
  40. *
  41.  
  42. CALLPP  MACRO
  43.         move.l a6,-(a7)         ; Save a6...
  44.         IFD SMALL_CODE
  45.         move.l _PPBase(a4),a6   ; If a4 addressing....
  46.         ENDC
  47.         IFD LARGE_CODE
  48.         move.l _PPBase,a6       ; If not a4 addressing...
  49.         ENDC
  50.         IFND SMALL_CODE
  51.         IFND LARGE_CODE
  52.         moveq.l #12323,a0       ; Cause an error!
  53.         ENDC
  54.         ENDC
  55.         jsr THIS_LIB(a6)
  56.         move.l (a7)+,a6
  57.         ENDM
  58.  
  59. * Now for the actual glue routines
  60.  
  61.         XREF _PPBase
  62.  
  63.         SECTION "PPGlue",CODE
  64.  
  65. *    ULONG ppLoadData (char *, ULONG, ULONG, UBYTE **, ULONG *, BOOL (*)());
  66. *    D0                A0      D0     D1     A1        A2       A3
  67.  
  68.         GLUEDEF ppLoadData
  69.         movem.l a2/a3,-(a7)
  70.         move.l  8+4(a7),a0
  71.         movem.l 8+8(a7),d0/d1/a1/a2/a3
  72.         CALLPP
  73.         movem.l (a7)+,a2/a3
  74.         rts
  75.  
  76. *    ULONG ppCalcChecksum (char *);
  77. *    D0                    A0
  78.  
  79.         GLUEDEF ppCalcChecksum
  80.         move.l 4(a7),a0
  81.         CALLPP
  82.         rts
  83.  
  84. *    ULONG ppCalcPasskey (char *);
  85. *    D0                   A0
  86.  
  87.         GLUEDEF ppCalcPasskey
  88.         move.l 4(a7),a0
  89.         CALLPP
  90.         rts
  91.  
  92. *    void ppDecrypt (UBYTE *, ULONG, ULONG);
  93. *                    A0       D0     D1
  94.  
  95.         GLUEDEF ppDecrypt
  96.         move.l  4(a7),a0
  97.         movem.l 8(a7),d0/d1
  98.         CALLPP
  99.         rts
  100.  
  101. *    BOOL ppGetPassword (struct Screen *, UBYTE *, ULONG, ULONG);
  102. *    D0                  A0               A1       D0     D1
  103.  
  104.         GLUEDEF ppGetPassword
  105.         movem.l 4(a7),a0/a1
  106.         movem.l 12(a7),d0/d1
  107.         CALLPP
  108.         rts
  109.  
  110. *    void ppDecrunchBuffer (UBYTE *, UBYTE *, ULONG *, ULONG);
  111. *                           A0       A1       A2       D0
  112.  
  113.         GLUEDEF ppDecrunchBuffer
  114.         move.l a2,-(a7)
  115.         movem.l 4+4(a7),a0/a1/a2
  116.         move.l  4+16(a7),d0
  117.         CALLPP
  118.         bra.s PopA2rts
  119.  
  120. *    BOOL ppGetString (struct Screen *, UBYTE *, ULONG, char *);
  121. *    D0                A0               A1       D0     A2
  122.  
  123.         GLUEDEF ppGetString
  124.         move.l a2,-(a7)
  125.         movem.l 4+4(a7),a0/a1
  126.         movem.l 4+12(a7),d0/a2
  127.         CALLPP
  128. PopA2rts:
  129.         move.l (a7)+,a2
  130.         rts
  131.  
  132. *    BOOL ppGetLong (struct Screen *, ULONG *, char *);
  133. *    D0              A0               A1       A2
  134.  
  135.         GLUEDEF ppGetLong
  136.         move.l a2,-(a7)
  137.         movem.l 4+4(a7),a0/a1/a2
  138.         CALLPP
  139.         bra.s PopA2rts
  140.  
  141.         END
  142.